package com.eorchis.module.department.domain;

import com.eorchis.core.basedao.entity.IBaseEntity;
import com.eorchis.module.user.domain.User;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="BASE_DEPARTMENT_USER")
public class DepartmentUser
  implements Serializable, IBaseEntity
{
  private static final long serialVersionUID = 1L;
  public static final Integer IS_ACTIVE_Y = new Integer(1);

  public static final Integer IS_ACTIVE_N = new Integer(2);
  private String deptUserID;
  private User user;
  private Department department;
  private Department oldDepartment;
  private Integer activeState;
  private Integer orderNum;
  private String levelDepId;//父级部门

  @Id
  @Column(name="DEPUSER_ID")
  @GeneratedValue(generator="system-uuid")
  @GenericGenerator(name="system-uuid", strategy="uuid")
  public String getDeptUserID()
  {
    return this.deptUserID;
  }

  public void setDeptUserID(String deptUserID) {
    this.deptUserID = deptUserID;
  }
  @ManyToOne(cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH}, fetch=FetchType.LAZY, optional=true)
  @JoinColumn(name="USERID")
  public User getUser() {
    return this.user;
  }

  public void setUser(User user) {
    this.user = user;
  }
  @ManyToOne(cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH}, fetch=FetchType.LAZY, optional=true)
  @JoinColumn(name="DEPID")
  public Department getDepartment() {
    return this.department;
  }

  public void setDepartment(Department department) {
    this.department = department;
  }
  @ManyToOne(cascade={javax.persistence.CascadeType.MERGE, javax.persistence.CascadeType.REFRESH}, fetch=FetchType.LAZY, optional=true)
  @JoinColumn(name="OLD_DEPTID")
  public Department getOldDepartment() {
    return this.oldDepartment;
  }

  public void setOldDepartment(Department oldDepartment) {
    this.oldDepartment = oldDepartment;
  }

  @Column(name="ACTIVE_STATE")
  public Integer getActiveState() {
    return this.activeState;
  }

  public void setActiveState(Integer activeState) {
    this.activeState = activeState;
  }

  @Column(name="ORDER_NUM")
  public Integer getOrderNum() {
    return this.orderNum;
  }

  public void setOrderNum(Integer orderNum) {
    this.orderNum = orderNum;
  }

    @Column(name="level_depid")
	public String getLevelDepId() {
		return levelDepId;
	}
	
	public void setLevelDepId(String levelDepId) {
		this.levelDepId = levelDepId;
}
}